using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace XiaoMan.Model.Models.Mapping
{
    public class DiaryMap : EntityTypeConfiguration<Diary>
    {
        public DiaryMap()
        {
            // Primary Key
            this.HasKey(t => t.DiaryID);

            // Properties
            this.Property(t => t.DiaryTitle)
                .HasMaxLength(50);

            this.Property(t => t.DiaryContent)
                .HasMaxLength(150);

            this.Property(t => t.DiaryPic)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Diary");
            this.Property(t => t.DiaryID).HasColumnName("DiaryID");
            this.Property(t => t.DiaryTitle).HasColumnName("DiaryTitle");
            this.Property(t => t.DiaryContent).HasColumnName("DiaryContent");
            this.Property(t => t.DiaryPic).HasColumnName("DiaryPic");
            this.Property(t => t.UserID).HasColumnName("UserID");
            this.Property(t => t.IsDelFlag).HasColumnName("IsDelFlag");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
        }
    }
}
